package ui;

import com.sun.lwuit.Button;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import java.util.Date;
import utils.DateUtils;

/**
 *
 * @author Shayan
 */
public class DateButton extends Button implements ActionListener {

    private Date date;

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
        setText(DateUtils.DatetoString(date));
        setAlignment(CENTER);
        addActionListener(this);
    }

    public DateButton() {
        setDate(new Date());
    }

    public void actionPerformed(ActionEvent evt) {
        setDate(CalendarDialog.show(date));
        evt.consume();
    }
}
